<!-- text按钮 -->
<template>
  <div class="btn-box-main">
    <div class="btn-box" :class="type" @click="openClick">
      <span v-if="!isIcon"><img :src="iconArr[iconName]" /></span><span>{{ text }}</span>
    </div>
  </div>
</template>

<script type="text/javascript">
import icon_1 from "@/assets/icon/icon_t (1).png";
import icon_2 from "@/assets/icon/icon_t (10).png";
import icon_3 from "@/assets/icon/icon_t (7).png";

export default {
  name: "btn-text",
  props: {
    type: {
      type: String,
      default: "primary",
    },
    text: {
      type: String,
      default: "",
    },
    isIcon:{
      type: Boolean,
      default: false,
    },
    iconName: {
      type: String,
      default: "icon_1",
    },
  },
  data() {
    return {
      iconArr: {
        icon_1, // 搜搜
        icon_2, // 重置
        icon_3, // 新增
      },
    };
  },
  methods: {
    openClick() {
      this.$emit("BtnClick");
    },
  },
};
</script>

<style lang="less" scoped>
.btn-box-main {
  width: 84px;
  font-size: 14px;
  cursor: pointer;
  img{
    width: 12px;
    height: 12px;
    margin: 5px 5px 0 0;
  }
  .btn-box {
    border-radius: 2px;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    padding:0 10px;
  }
  .primary {
    background: #2d8cf0;
  }
  .warning {
    background: #f90;
  }
  .error {
    background: #ed4014;
  }
  .success {
    background: #19be6b;
  }
  .green {
    background: #1ccad5;
  }
  .light-blue {
    color: #0052d9;
    background: rgba(45,143,255,0.14);
  }
}
</style>
